package com.naiterui.ehp.bs.patient.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.patient.domain.PatientWeixinLog;
import com.naiterui.ehp.bs.patient.repository.IApPatientWeixinLogRepository;
import com.naiterui.ehp.bs.patient.service.IPatientWeixinLogService;

/**
 * 微信操作日志业务实现层
 *
 * @since 2.24
 */
@Service
public class ApPatientWeixinLogServiceImpl implements IPatientWeixinLogService {
    @Autowired
    private IApPatientWeixinLogRepository patientWeixinLogRepository;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addCancelLog(Long patientId) throws BusinessException {
        PatientWeixinLog weixinLog = new PatientWeixinLog();
        weixinLog.setPatientId(patientId);
        weixinLog.setCancelAt(new Date());
        weixinLog.setCreatedAt(new Date());
        patientWeixinLogRepository.save(weixinLog);
    }

}
